package org.jix.gbook.kv.biz.controller;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.jix.framework.common.response.Response;
import org.jix.gbook.kv.biz.service.NoteContentService;
import org.jix.gbook.kv.dto.req.AddNoteContentReqDTO;
import org.jix.gbook.kv.dto.req.DeleteNoteContentReqDTO;
import org.jix.gbook.kv.dto.req.FindNoteContentReqDTO;
import org.jix.gbook.kv.dto.resp.FindNoteContentRespDTO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author stark
 * @date 2025/7/21 16:26
 * @description 笔记内容业务接口
 **/
@RestController
@RequestMapping("/kv")
@Slf4j
public class NoteContentController {

    @Resource
    private NoteContentService noteContentService;

    /**
     * 添加笔记内容
     * @param addNoteContentReqDTO
     * @return
     */
    @PostMapping(value = "/note/content/add")
    public Response<?> addNoteContent(@RequestBody @Validated AddNoteContentReqDTO addNoteContentReqDTO) {
        return noteContentService.addNoteContent(addNoteContentReqDTO);
    }

    /**
     * 查询笔记内容
     * @param findNoteContentReqDTO
     * @return
     */
    @PostMapping(value = "/note/content/find")
    public Response<FindNoteContentRespDTO> findNoteContent(@RequestBody @Validated FindNoteContentReqDTO findNoteContentReqDTO) {
        return noteContentService.findNoteContent(findNoteContentReqDTO);
    }

    @PostMapping(value = "/note/content/delete")
    public Response<?> deleteNoteContent(@RequestBody @Validated DeleteNoteContentReqDTO deleteNoteContentReqDTO) {
        return noteContentService.deleteNoteContent(deleteNoteContentReqDTO);
    }
}
